#!/bin/sh

LOG_HOME=/home/$1/vm-setup-logs

JAVA_PACKAGE=$2
TOMCAT_PACKAGE=$3
TOMCAT_SERVICE=$4
TOMCAT_USERS=$5
TOMCAT_SERVERCONF=$6
TOMCAT_MANAGERCONTEXT=$7
TOMCAT_HOSTMANAGERCONTEXT=$8

AIRSONIC_PACKAGE=$9
TOMCAT_CONTEXT=$10
MYSQL_DRIVER=$11

MYSQL_CLIENT_PACKAGE=$12
MYSQL_ADMIN_USER=$13
MYSQL_ADMIN_PASS=$14
MYSQL_SERVER_HOST=$15
MYSQL_DBNAME=$16

mkdir $LOG_HOME

sh java-tomcat-install.sh $JAVA_PACKAGE $TOMCAT_PACKAGE $TOMCAT_SERVICE $TOMCAT_USERS $TOMCAT_SERVERCONF $TOMCAT_MANAGERCONTEXT $TOMCAT_HOSTMANAGERCONTEXT >> $LOG_HOME/java-tomcat-install.log
sh airsonic-install.sh $AIRSONIC_PACKAGE >> $LOG_HOME/airsonic-install.log
sh mysql-install.sh $MYSQL_CLIENT_PACKAGE $MYSQL_ADMIN_USER $MYSQL_SERVER_HOST $MYSQL_ADMIN_PASS >> $LOG_HOME/mysql-install.log
sh mysql-bind.sh $TOMCAT_CONTEXT $MYSQL_DRIVER $MYSQL_ADMIN_USER $MYSQL_ADMIN_PASS $MYSQL_DBNAME $MYSQL_SERVER_HOST >> $LOG_HOME/mysql-bind.log